﻿@model GPS.MODELS.EditUserViewModel

@{
    ViewBag.Title = "Edit";
}



<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

<script type="text/javascript">

    $(document).ready(function () {
        // load district by province when change in dropdownlist
        $("#province_dll").change(function () {
            $.ajax({
                url: '@Url.Action("getDistrict","Account")',
                type: 'post',
                data: {
                    ma_TinhTP: $('#province_dll').val()
                }
            }).done(function (response) {
                // update district by province
                var a = '<option value></option>' + response;   // defaut value
                $("#district_dll").html(a);

                // reset ward
                var b = '<option value></option>'
                $('#ward_dll').html(b);
            });
        });


        // load ward by disctrict when change in dropdownlist
        $("#district_dll").change(function () {
            $.ajax({
                url: '@Url.Action("getWard", "Account")',
                type: 'post',
                data: {
                    ma_QuanHuyen: $('#district_dll').val()
                }
            }).done(function (response) {
                var a = '<option value></option>' + response;   // defaut value
                $("#ward_dll").html(a);
            });
        });
    });

</script>


<div class="container fdb-div-content fdb-div-corner-all">
    <br />
    @using (Html.BeginForm())
    {
        <h3 class="text-center fdb-title-search-form">Chỉnh Sửa Người Dùng</h3>
        <div id="tabs-1">
            @Html.Hidden("IsEdit", 0)
            @Html.AntiForgeryToken()
            <fieldset class="fs_body">
                <legend class="head_title">Thông tin người dùng</legend>
                <div class="form-horizontal">
                    @Html.ValidationSummary(true)
                    <div class="form-group">
                        @Html.LabelFor(model => model.UserName, new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @Html.TextBoxFor(model => model.UserName, new { @class = "form-control", @readonly = true })
                            @Html.ValidationMessageFor(model => model.UserName)
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-2 control-label">
                            Họ đệm
                        </div>
                        <div class="col-md-10">
                            @Html.TextBoxFor(model => model.FirstName, new { @class = "form-control" })
                            @Html.ValidationMessageFor(model => model.FirstName)
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-2 control-label">
                            Tên
                        </div>
                        <div class="col-md-10">
                            @Html.TextBoxFor(model => model.LastName, new { @class = "form-control" })
                            @Html.ValidationMessageFor(model => model.LastName)
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-2 control-label">
                            Email
                        </div>
                        <div class="col-md-10">
                            @Html.TextBoxFor(model => model.Email, new { @class = "form-control" })
                            @Html.ValidationMessageFor(model => model.Email)
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-2 control-label">
                            Đơn vị công tác
                        </div>
                        <div class="col-md-10">
                            @Html.TextBoxFor(m => m.DON_VI_CONG_TAC, new { @class = "form-control" })
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-2 control-label">
                            Chức vụ
                        </div>
                        <div class="col-md-10">
                            @Html.TextBoxFor(m => m.CHUC_VU, new { @class = "form-control" })
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-2 control-label">
                            Đơn vị GTVT <label style="color:red;">(*)</label>
                        </div>
                        <div class="col-md-10">
                            @Html.DropDownListFor(model => model.MA_TINHTP, (SelectList)ViewBag.TINH_THANHPHOs, string.Empty, new { @class = "form-control", @id = "province_dll" })
                            @Html.ValidationMessageFor(model => model.MA_TINHTP)
                        </div>
                    </div>

                    @*<div class="form-group">
                        <div class="col-md-2 control-label">
                            Quận/huyện/thị xã
                        </div>
                        <div class="col-md-10">
                            @Html.DropDownListFor(model => model.MA_QUANHUYEN, (SelectList)ViewBag.QUAN_HUYENs, string.Empty, new { @class = "form-control", @id = "district_dll" })
                            @Html.ValidationMessageFor(model => model.MA_QUANHUYEN)
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-2 control-label">
                            Xã/phường
                        </div>
                        <div class="col-md-10">
                            @Html.DropDownListFor(model => model.MA_PHUONGXA, (SelectList)ViewBag.PHUONG_XAs, string.Empty, new { @class = "form-control", @id = "ward_dll" })
                            @Html.ValidationMessageFor(model => model.MA_PHUONGXA)
                        </div>
                    </div>*@

                    <div class="form-group">
                        <div class="col-md-offset-2 col-md-10">
                            <button type="submit" class="btn btn-danger btn-sm">
                                <span class="glyphicon glyphicon-floppy-disk"></span> Cập nhật
                            </button>
                            &nbsp;
                            @Html.ActionLink("Quay lại", "Index", "Account", null, new { @class = "btn btn-primary btn-sm" })
                        </div>
                    </div>
                </div>
            </fieldset>
        </div>
    }

    @section Scripts {
        @Scripts.Render("~/bundles/jqueryval")
    }
